--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
meshchatx/src/backend/announce_handler.py a9cc4b996b8da8ff414e305825f372ca12dc138d (a9cc4b99) Text, 1.12 KB
T8b949e# SPDX-License-Identifier: 0BSD AND MIT
T8b949e# an announce handler that forwards announces to a provided callback for the provided aspect filter
T8b949e# this handler exists so we can have access to the original aspect, as this is not provided in the announce itself
Tff7b72class T56d364AnnounceHandlerTb4b4b4:
Tff7b72def Tff7b72__init__Tb4b4b4(Tff7b72selfTb4b4b4, Te6edf3aspect_filterTb4b4b4: Tffa657strTb4b4b4, Te6edf3received_announce_callbackTb4b4b4)Tb4b4b4:
Tff7b72selfTff7b72.Td2a8ffaspect_filter Tff7b72= Te6edf3aspect_filter
Tff7b72selfTff7b72.Td2a8ffreceived_announce_callback Tff7b72= Te6edf3received_announce_callback
T8b949e# we will just pass the received announce back to the provided callback
Tff7b72def Td2a8ffreceived_announceTb4b4b4(
Tff7b72selfTb4b4b4,
Te6edf3destination_hashTb4b4b4,
Te6edf3announced_identityTb4b4b4,
Te6edf3app_dataTb4b4b4,
Te6edf3announce_packet_hashTb4b4b4,
Tb4b4b4)Tb4b4b4:
Tff7b72tryTb4b4b4:
T8b949e# handle received announce
Tff7b72selfTff7b72.Td2a8ffreceived_announce_callbackTb4b4b4(
Tff7b72selfTff7b72.Td2a8ffaspect_filterTb4b4b4,
Te6edf3destination_hashTb4b4b4,
Te6edf3announced_identityTb4b4b4,
Te6edf3app_dataTb4b4b4,
Te6edf3announce_packet_hashTb4b4b4,
Tb4b4b4)
Tff7b72except Tf85149Exception Tff7b72as Te6edf3eTb4b4b4:
T8b949e# ignore failure to handle received announce
Tffa657printTb4b4b4(Ta5d6fffTa5d6ff"Ta5d6ffFailed to handle received announce: Tffd700{Te6edf3eTffd700}Ta5d6ff"Tb4b4b4)
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────